#!/usr/bin/evn python
# -*- coding: UTF-8 -*-
# @File: manage_contact_page.py
# @Author: fy
# @date: 2021/9/13 16:11
from pages.base_page import BasePage
from pages.edit_member_page import EditMemberPage
from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.webelement import WebElement


class ManageContactsPage(BasePage):

    def goto_edit_member_page(self, name):
        _edit_member_btn_locator = (MobileBy.XPATH,
                                    '//*[@class="android.widget.ListView"]//*[@text="{}"]/../../../../android.widget.RelativeLayout'.format(
                                        name))
        self.scroll_and_click(_edit_member_btn_locator)
        return EditMemberPage(self.driver)
